package com.lifeng.service.impl;

import com.lifeng.config.datasource.DataSourceType;
import com.lifeng.config.datasource.annotation.DataSource;
import com.lifeng.domain.OrderBean;
import com.lifeng.mapper.OrderMapper;
import com.lifeng.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by lifeng on 2019/4/30.
 */
@Service
public class OrderServiceImpl implements OrderService{
    @Resource
    private OrderMapper orderMapper;
    @Override
    public int insert(OrderBean orderBean) {
        return orderMapper.insert(orderBean);
    }

    @DataSource(DataSourceType.SLAVE)
    @Override
    public OrderBean selectByOrderNo(Long orderNo) {
        return orderMapper.selectByOrderNo(orderNo);
    }

    @DataSource(DataSourceType.SLAVE)
    @Override
    public List<OrderBean> selectListForPage(OrderBean orderBean) {
        return orderMapper.selectListForPage(orderBean);
    }

    @Override
    public int delete(OrderBean orderBean) {
        return orderMapper.delete(orderBean);
    }
}
